<template>

 <sweet-modal ref="dialogInfo" class="dialog"  :sweetModalMaxWidth="pageWidth">
     <h3>{{title}}</h3>
      <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">灵堂名称</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.LINNAME" readonly></el-input>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">业务编号</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGBUSNUM" readonly></el-input>
                </div>
            </div>
        </div>

          <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">逝者姓名</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGNAME" readonly></el-input>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGSEXs" readonly></el-input>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">死亡日期</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGDEATHDATE" readonly></el-input>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">家属姓名</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGHANDLERNAME" readonly></el-input>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">家属电话</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGHANDLERLINK" readonly></el-input>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">证件号码</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.REGCARDNO" readonly></el-input>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">车牌号</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.CARNO" readonly></el-input>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">处理单位</label>
                <div class="layui-input-inline">
                    <el-input v-model="ichData.PRPPROCESSINGUNIT" readonly></el-input>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                    <el-date-picker v-date type="datetime" v-model="ichDataEexend.staTime" readonly></el-date-picker>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <el-date-picker v-date type="datetime" v-model="ichDataEexend.endTime" readonly></el-date-picker>
                </div>
            </div>
        </div>
    
      </div>
    <div class="layui-form-item btnCenter sweet-btn">
        <el-button  @click="closeDialog" >取消</el-button>
    </div>
 </sweet-modal>

</template>

<style  rel="stylesheet/scss" lang="scss" scoped>

</style>
<script>
const INFO="详情"
import apiBase from "@/api/apiBase.js";
import sweetModal from "@/components/sweetModal";
import {  formatDate,timeStringToDate,dateStringToDate } from "@/utils/date.js";
  export default {
    data(){
        return{
        ichData:{
            REGSEXs:null
        },
        ichDataEexend:{
            staTime:null,
            endTime:null
            },

        pageWidth: 700,
        maxHeight: 500,
        title:null,
        order:null,
        }
    },
      methods:{
        open(order, id) {
             this.order = order;
            switch (this.order) {
                case INFO:
                //this.$refs.dialogInfo.open();
                this.title = "灵堂使用详情";
                this.dataInfo(id);
                break;
    
            default:
            }
        },
        //提交
        // submit(checkout = false) {
        // switch (this.order) {

        //     case INFO:
        //         break;
        //     default:
        // }
        // },
        closeDialog() {
            this.$refs.dialogInfo.close();
        },
         sex(sex) {
      var result;
      if (sex) {
        switch (sex) {
          case "A":
            result = "男";
            break;
          case "B":
            result = "女";
            break;
          case "C":
            result = "未知的性别";
            break;
          case "D":
            result = "未说明的性别";
            break;
          default:
        }
      } else {
        result = "D";
      }
      return result;
    },
        //登记详情
        dataInfo(id) {
            console.log('我是详情');
            let data = {
                ICHID: id
            };
            apiBase.DoService(
                data,
                apiBase.getApiAdress().MourningUse.Query,
                res => {
                    this.ichData  =  res.data.content.OutData[0];
                    this.ichData.REGSEXs = this.sex(this.ichData.REGSEX)
                    this.ichDataEexend.staTime = timeStringToDate(
                        this.ichData.ICHBEGTIME, this.ichData.ICHBEGDATE
                    );
                    this.ichDataEexend.endTime = timeStringToDate(
                        this.ichData.ICHENDTIME,this.ichData.ICHENDDATE
                    );
                    this.$refs.dialogInfo.open();
                 
            })
        }, 
    },
    components: {
        sweetModal
    },
    created() {},
  };
</script>

